﻿<!DOCTYPE html>
<html>
<head>

  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <title></title>
  <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
  <!-- <link rel="stylesheet" href="https://d10ajoocuyu32n.cloudfront.net/mobile/1.3.1/jquery.mobile-1.3.1.min.css">-->
  <link rel="stylesheet" href="../css/jquery.mobile-1.3.1.min.css">
  <link rel="stylesheet" href="file:///android_asset/css/in.css">
  <!-- Extra Codiqa features -->
  <link rel="stylesheet" href="codiqa.ext.css">
  <!-- jQuery and jQuery Mobile -->
  <script src="https://d10ajoocuyu32n.cloudfront.net/jquery-1.9.1.min.js"></script>
  <script src="https://d10ajoocuyu32n.cloudfront.net/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
  <!-- Extra Codiqa features -->
  <script src="https://d10ajoocuyu32n.cloudfront.net/codiqa.ext.js"></script>
   
</head>
<body>
<!-- Home -->
<div data-role="page" id="page1" data-theme="b">
            <div data-role="header" data-theme="b" align="center">
              <h1 style="font-weight:bold;" height="20"> Create Account </h1>
            </div><!-- Header -->
			<div data-role="content" align="center">
				<form action="" method="" >
					<div>
						<input name="usr_fn" id="usr_fn" placeholder="first name" value="" type="text">
					</div>
					<div>
					   <input name="usr_ln" id="usr_ln" placeholder="last name" value="" type="text">
					</div>
					
					<div>
					   <input name="usr_mail" id="usr_mail" placeholder="email address" value="" type="text">
					</div>
					<div >
					  <input name="usr_pwd" id="usr_pwd" placeholder="password" value="" type="password">
					</div>
					<div>
						<input name="usr_re_pwd" id="usr_re_pwd" placeholder="confirm password" value="" type="password">
					</div><br>
					<!--<div>
						 <input name="usr_gym_nme" id="usr_gym_nme" placeholder="home location id" value="" type="text">
					</div><br>-->
					<div>
						<input type="checkbox" value="0" style="margin:1px 0 0 -21px" id="check1" name="check1"/>
						<center><div style="font-family:small-caption,caption,Lucida Sans Unicode;font-size:18px;" align="center"> I Have Read and Agree To The </div></center>
					</div>	
					<div>
						<a style="font-family:Lucida Sans Unicode; font-size:18px">
							Terms and Conditions
						</a>
					</div>
					<center> <a href="#" align="center"> <img src="../images/create_account.png" onclick="createAccount(this.form)"></a></center>
					<div>
						<p style="font-size:50pt;"> </p>
					</div>
				</form>
			</div>
</div>
<!--<div style="background-image: url(../images/topbar.png); bottom:0;text-align:center;margin:0px 0px 0px 0px;" id="sample" class="ui-footer-fixed " > 
				<div style="margin:8px 0px -7px 17px;">
					<img  style="margin:0px -1px 13px -17px;" class="folder" src="../images/folder.png"  height="40" width="40">
					<img  style="margin:0px -1px 13px 19px;" class="folder" src="../images/settings.png" height="40" width="40">
					<img  style="margin:0px -1px 13px 19px;" class="" src="../images/home.png" height="40" width="40" onclick="home()">
					<img  style="margin:0px -1px 13px 19px;" class="folder" src="../images/boulder.png" height="40" width="40" onclick="boulder()">
					<img  style="margin:0px -1px 13px 19px;" class="folder" src="../images/route.png" height="40" width="40" onclick="route()">
				</div>
	</div>-->						
</body>
</html>
	<script type="text/javascript" charset="utf-8" src="file:///android_asset/js/cordova.js"></script>
		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
		</script>
<script>
	function createAccount(frm){
	var fname=document.getElementById('usr_fn').value;
	var lname=document.getElementById('usr_ln').value;
	var email=document.getElementById('usr_mail').value;
	var pwd=document.getElementById('usr_pwd').value;
	var cpwd=document.getElementById('usr_re_pwd').value;
	if(fname==""){
	navigator.notification.alert("Please enter the first name" );
	return false;
	}
	if(lname==""){
	navigator.notification.alert("Please enter the last name" );
	return false;
	}
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if(email==""){
		navigator.notification.alert("Please enter the email" );
		return false;
	}
	else if (!filter.test(email)){
		navigator.notification.alert("Please provide a valid email address" );
		return false;
	}
	if(pwd==""){
	navigator.notification.alert("Please enter the password" );
	return false;
	}
	if(cpwd==""){
	navigator.notification.alert("Please enter the confirmation password" );
	return false;
	}
	if(cpwd!=pwd){
	navigator.notification.alert("Password Confirmation Is Incorrect" );
	return false;
	}
	if(document.getElementById('check1').checked==false){
	navigator.notification.alert("Please Select The Checkbox");
	}else{
       $.ajax({
			type: "POST",
			url: 'http://192.237.186.169/forerunner/create_account?token=BicOjMGGCG/NmuPjmG4RiA==',
			contentType: "application/json; charset=utf-8",
			data:JSON.stringify({"email":email,"password":pwd,"firstName":fname,"lastName":lname}),
			success: function(data){
				if(data.status == "SUCCESS"){
					navigator.notification.alert("The Route Database Has Been Updated");
					window.location='index_login.html';					
				}
				else{
					navigator.notification.alert(data.errorMessage);
				}				
				//navigator.notification.alert(data);
			}
		});	
	}	
}

</script>